import { history, useLocation } from 'umi';
// import Login from "../Login/index"
import {Button} from "antd"

console.log(32423);

export default (props: any) => {
  let token = localStorage.getItem('token');
  let location = useLocation();
  if (!token) {
    if (location.pathname !== '/login') {
      console.log(32423);
      return (<div>
        <Button onClick={()=>{
          history.push("/login")
        }} >去登陆</Button>
      </div>);
    }
  } else {
    return <div>{props.children}</div>;
  }
};
